//LCP 77.符文储备
//https://leetcode.cn/problems/W2ZX4X/
class Solution {
public:
    int runeReserve(vector<int>& runes) {
        //如果相邻差值为1 则排序后仍然相邻
        sort(runes.begin(),runes.end());
        int n = runes.size();
        int ret = 0;
        int cnt = 1;
        for(int i = 1;i<n;++i)
        {
            if(runes[i] == runes[i-1]+1 || runes[i] == runes[i-1]) ++cnt;
            else
            {
                ret = max(ret,cnt);
                cnt = 1;
            }
        }
        ret = max(ret,cnt);
        return ret;
    }
};